#include "CircularBufferTemplate.h"
#include <stdio.h>

typedef struct o{
    int data[100];
}obj;

typedef struct x{
    char id;
    int data[10];
}xt;

static int int_cmp(int* a,int* b){
    return -1;
}
static int long_cmp(long* a,long* b){
    return -1;
}
static int char_cmp(char* a,char* b){
    return a - b ;
}
static int obj_cmp(obj* a,obj* b){
    return -1;
}
static int xt_cmp(xt* a,xt* b){
    return -1;
}

CIRCULAR_BUF_CREATE(int)
CIRCULAR_BUF_CREATE(obj)
CIRCULAR_BUF_CREATE(long)
CIRCULAR_BUF_CREATE(xt)
CIRCULAR_BUF_CREATE(char)

static int pool_int[128];
static obj pool_obj[128];

static CIRCULAR_BUF_DEFINE(int,buf_int);
static CIRCULAR_BUF_DEFINE(obj,buf_obj);

char *content = "aobxxafbimpafbkkkkmmafbcdaaaab";
char *pattern = "ab";

int main(int argc,char** argv)
{
    printf("test cbuf sizeof:%d\n",
           sizeof(circular_buffer_int));

    printf("test cbuf sizeof:%d\n",
           sizeof(circular_buffer_char));

    printf("test cbuf sizeof:%d\n",
           sizeof(circular_buffer_obj));

    printf("test xt sizeof:%d\n",
               sizeof(circular_buffer_xt));
    int data = 0;
    obj tank;

    CIRCULAR_BUF_INIT(&buf_int,int,int_cmp,&pool_int[0],12);

    CIRCULAR_BUF_PUT(&buf_int,int,&data);

    CIRCULAR_BUF_INIT(&buf_obj,obj,obj_cmp,&pool_obj[0],12);

    CIRCULAR_BUF_GET(&buf_obj,obj,&tank);
    CIRCULAR_BUF_PUT(&buf_obj,obj,&tank);

    CIRCULAR_BUF_RESET(&buf_int,int);

    return 0;
}
